/**
 * 属性模块接口文件
 */

import axios from './request';

/**
 * 属性接口
 */
export interface IAttrs {
    id: number;
    name: string;
    class_id: number;
}

/**
 * 添加类型
 */
export type AddType = Omit<IAttrs, 'id'>;

/**
 * 获取列表
 * @returns 
 */
export const getList = async (id: number): Promise<IAttrs[]> => axios.get('/attrs/list/' + id);

/**
 * 添加
 * @param model 
 * @returns 
 */
export const add = async (model: AddType) => axios.post('/attrs/add', model);

/**
 * 修改
 * @param model 
 * @returns 
 */
export const update = async (model: IAttrs) => axios.put('/attrs/update', model);

/**
 * 删除
 * @param id 
 * @returns 
 */
export const deleteAttrs = async (id: number) => axios.delete('/attrs/delete/' + id);